using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;

public class SkinExporterABTestPanel : MonoBehaviour
{
	private MyMiniTween[] miniTweens;

	public static bool showPanel = true;

	public static bool showMinecraftLabel = true;

	public static bool showExporter;

	public static string jsonKey = "SkinExporterABTestPanel";

	public static string minecraftLabelKey = "SkinExporterShowMinecraftLabel";

	public static string startWithInternetKey = "SkinExporterStartWithInternet";

	public GameObject loadAnimation;

	public static SkinExporterABTestPanel instance;

	private Coroutine loadWindow;

	private Coroutine loadLevelMenuCoroutine;

	private AsyncOperation load;

	public void loadExporter()
	{
		if (SkinExporterWindow.instance == null)
		{
			if (loadWindow == null)
			{
				loadWindow = StartCoroutine(LoadSkinExporterWindow());
			}
		}
		else
		{
			SkinExporterWindow.instance.ShowChooseSkinWindow();
		}
	}

	private IEnumerator LoadSkinExporterWindow()
	{
		ResourceRequest loadPlayer = Resources.LoadAsync("Prefabs/Lobby/SkinsExporterPanel");
		yield return loadPlayer;
		GameObject tmp = Object.Instantiate(loadPlayer.asset as GameObject);
		tmp.transform.parent = base.transform.parent;
		tmp.transform.localScale = Vector3.one;
		yield return null;
		tmp.GetComponent<SkinExporterWindow>().ShowChooseSkinWindow();
	}

	private void Awake()
	{
		instance = this;
	}

	private void Start()
	{
		miniTweens = GetComponentsInChildren<MyMiniTween>();
		Show(true);
	}

	public void Show(bool val)
	{
		MyMiniTween[] array = miniTweens;
		foreach (MyMiniTween myMiniTween in array)
		{
			myMiniTween.Show(val);
		}
	}

	public void OnClickBlockCity()
	{
		showExporter = false;
		showPanel = false;
		loadAnimation.SetActive(true);
		if (loadLevelMenuCoroutine == null)
		{
			loadLevelMenuCoroutine = StartCoroutine(LoadLevelMenu());
		}
	}

	public void OnClickSkinsExporter()
	{
		showExporter = true;
		loadExporter();
		Show(false);
	}

	public IEnumerator LoadLevelMenu()
	{
		yield return new WaitForSeconds(0.5f);
		if (BCWStorage.Get<bool>(settings.keyCryptoTutorialActive))
		{
			load = SceneManager.LoadSceneAsync("Lobby");
		}
		else
		{
			load = SceneManager.LoadSceneAsync("Tutorial");
		}
	}
}
